﻿@model IEnumerable<Arch.Samples.Model.Todo>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

@using (Html.BeginForm("Search", "Todo", FormMethod.Get)) {
    <table width="100%">
        <tr>
            <td>
                @Html.Editor("Query", ViewData["Query"])
            </td>
            <td>
                <input type="submit" value="Search" />
            </td>
        </tr>
    </table>
}

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th></th>
        <th>
            Title
        </th>
        <th>
            Description
        </th>
        <th>
            Version
        </th>
        <th>
            CreationDate
        </th>
        <th>
            UpdateDate
        </th>
        <th>
            CreationUser
        </th>
        <th>
            GlobalCategory
        </th>
        <th>
            SubCategory
        </th>
    </tr>

@foreach (var item in Model)
{
    <tr>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id = item.Id }) |
            @Html.ActionLink("Details", "Details", new { id = item.Id }) |
            @Html.ActionLink("Delete", "Delete", new { id = item.Id })
        </td>
        <td>
            @item.Title
        </td>
        <td>
            @item.Description
        </td>
        <td>
            @item.Version
        </td>
        <td>
            @String.Format("{0:g}", item.CreationDate)
        </td>
        <td>
            @String.Format("{0:g}", item.UpdateDate)
        </td>
        <td>
            @item.CreationUser
        </td>
        <td>
            @item.GlobalCategory
        </td>
        <td>
            @item.SubCategory
        </td>
    </tr>
}

</table>

